import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite";
import path from "node:path";
import { defineConfig } from "vite";

import tsconfigPaths from 'vite-tsconfig-paths'
import { reactRouterDevTools } from "react-router-devtools";
export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./app"),
    },
  },

  plugins: [reactRouterDevTools(), tailwindcss(), reactRouter(), tsconfigPaths()],
  server: {
    port: 5010,
    host: true,
    proxy: {
      "/api": {
        target: "http://localhost:5010",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
});
